import { http } from '@/utils/http'
import { packagedGetFileInfoResult } from '@/utils/upload-tool'
/**
 * 个人会员 - 新增/编辑
 */
export const createOrUpdateMember = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/czcCustMember/createUpdate',
    data: y,
  })
}

/**
 * 个人会员 - 详情
 */
export const memberDetail = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/czcCustMember/detail',
    data: y,
  })
}

/**
 * 个人会员 - 会员标签
 */
export const addLabel = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/czcCustMember/addLabel',
    data: y,
  })
}

/**
 * 个人会员 - 拉黑
 */
export const toBlock = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/czcCustMember/block',
    data: y,
  })
}

/**
 * 个人会员 - 恢复
 */
export const toRestore = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/czcCustMember/normal',
    data: y,
  })
}

/**
 * 企业会员 - 详情
 */
export const clientInfoDetail = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/clientInfo/detail',
    data: y,
  })
}

/**
 * 企业会员 - 新增
 */
export const createClientInfo = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/clientInfo/save',
    data: y,
  })
}

/**
 * 企业会员 - 详情
 */
export const editClientInfo = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/V5/clientInfo/update',
    data: y,
  })
}

/**
 * 企业会员 - 身份证正面 OCR
 */
export const IdCardFrontOCR = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/ocr/resolveIdCardFront',
    data: y,
  })
}

/**
 * 企业会员 - 身份证反面 OCR
 */
export const IdCardBackOCR = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/ocr/resolveIdCardBack',
    data: y,
  })
}

/**
 * 企业会员 - 驾驶证正面 OCR
 */
export const driverCardFrontOCR = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/ocr/resolveDriveCardFront',
    data: y,
  })
}

/**
 * 企业会员 - 驾驶证反面 OCR
 */
export const driverCardBackOCR = (y: { id: any }) => {
  return http({
    method: 'POST',
    url: '/ocr/resolveDriveCardBack',
    data: y,
  })
}

/**
 * 企业会员 - 根据文件ID获取文件信息
 */
export const getFileInfo = (y: { id: any }) => {
  return new Promise((resolve, reject) => {
    http({
      method: 'POST',
      url: '/uploadFile/getFileInfo',
      data: y,
    })
      .then((res) => {
        packagedGetFileInfoResult(res)
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
